<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr1 = [1, 45];
        //push 从后面添加 格式：数组.push(参数1, 参数2...);
        arr1.push(22);
        console.log(arr1);

        //unshift 从前面添加 格式：数组.unshift(参数1, 参数2...)
        arr1.unshift("消", 12);
        console.log(arr1);

        var arr2 = ['迪丽热巴', '杨幂', '关晓彤', '杨超越'];
        //shift 从前面删除
        arr2.shift();
        console.log(arr2); //["杨幂", "关晓彤", "杨超越"]

        //pop 从后面删除
        arr2.pop();
        console.log(arr2); //["杨幂", "关晓彤"]
    </script>
</body>
</html>